<div class="container-fluid" style="margin-top: 10px;">
    <div class="row">
        <form id="constructionForm" action="edit">
            {:buildForm($config,$data)}
            <div class="col-sm-12" style="margin-top: 10px;margin-bottom: 20px;text-align: center">
                <button id="addButton" type="button" class="btn btn-info btn-sm">保存</button>
                <button type="reset" class="btn btn-default btn-sm">重置</button>
                <button id="printButton" type="button" class="btn btn-success btn-sm">打印</button>
            </div>
        </form>
    </div>
</div>

<script>

    $(function () {
         $("#addButton").on('click',function () {
             layer.confirm('确认更新信息吗？',function (index) {
                 layer.close(index);
                 layer.load();
                 $("#constructionForm").ajaxSubmit(function (text) {
                     console.log(text);
                     layer.closeAll('loading');
                     var json = JSON.parse(text);
                     if(json['code'] == '200'){
                         layer.alert(json['msg'],{icon:1},function (index) {
                             layer.close(index);
                             parent.location.reload();
                         })
                     }
                     else{
                         layer.alert(json['msg'],{icon:2});
                     }
                 });
             });
         });
        $("#printButton").on('click',function () {
            var id = $("input[name='INTANG_NO']").val();
            window.open("{:url('printPage')}?id="+id);
        })
    });

</script>